using Autenticazione;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
namespace BusinessObject
{
	public class Descrizione
	{
		private int Tipo = -1;
		private long id;
		private string description;
		public long Id
		{
			get
			{
				return this.id;
			}
			set
			{
				this.id = value;
			}
		}
		public string Description
		{
			get
			{
				return this.description;
			}
			set
			{
				this.description = value;
			}
		}
		public Descrizione(int tipo)
		{
			this.Tipo = tipo;
		}
		public Descrizione(long id, string description)
		{
			this.Id = id;
			this.Description = description;
		}
		public List<Descrizione> GetDescriptions(int tipo)
		{
			List<Descrizione> descriptions = new List<Descrizione>();
			string strSQL = string.Format("select * from Descriptions where Type = {0} order by Description", tipo.ToString());
			DB db = new DB();
			SqlDataReader dr = db.Reader(strSQL);
			if (dr == null)
			{
				return descriptions;
			}
			while (dr.Read())
			{
				descriptions.Add(new Descrizione(long.Parse(dr["Id"].ToString()), dr["Description"].ToString()));
			}
			db.CloseConnection();
			return descriptions;
		}
	}
}
